#include <ctype.h>
#include <exception>
#include<iostream>
#include<string>
using namespace std;
class Solution0 {
public:
    string reverseVowels(string s) {
        int right=s.size()-1,left=0;
        string tag="aeiouAEIOU";
        while(left<=right)
        {
            
            while(left<=right&&tag.find(s[left])==-1)left++;
            while(left<=right&&tag.find(s[right])==-1)right--;
            if(left<=right)swap(s[left],s[right]);  
            left++;
            right--;
        }
        return s;
    }

};
class Solution {
public:
    string reverseVowels(string s) {
        int right=s.size()-1,left=0;
        while(left<=right)
        {
            
            while(left<=right&&!map(s[left]))left++;
            while(left<=right&&!map(s[right]))right--;
            if(left<=right)swap(s[left],s[right]);
            
            left++;
            right--;
        }
        return s;
    }
    int map(char ch)
    {
        switch (ch) {
            case 'A':return 1;
            case 'E':return 1;
            case 'I':return 1;
            case 'O':return 1;
            case 'U':return 1;
            case 'a':return 1;
            case 'e':return 1;
            case 'i':return 1;
            case 'o':return 1;
            case 'u':return 1;
        }
        return 0;
    }
};